home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / source / music4c.sit / Music4C Folder / Sources Folder / About_Dialog_Box.c next >
Text File  |  1990-06-08  |  3KB  |  133 lines

  1. /*
  2. * ⌐ Graeme Gerrard 1990
  3. * Faculty of Music, University of Melbourne
  4. * Parkville Victoria 3052 Australia.
  5. *
  6. * ARPANET: grae@murdu.ucs.unimelb.edu.au
  7. * telephone: (613) 344 4127, Fax: (613) 344 5346
  8. */
  9. #include "About_Dialog_Box.h"
  10.  
  11. static pascal char  MyFilter (DialogPtr   theDialog,  EventRecord   *theEvent,  short  *itemHit);
  12.  
  13. static void  Refresh_Dialog(DialogPtr    GetSelection);
  14.  
  15. #define      TRUE   1
  16. #define      FALSE  0
  17. #define      NIL    0
  18.  
  19. #define  I_Picture2   1
  20. #define  I_Rectangle1   2
  21.     static char   ExitDialog; 
  22.     static char   DoubleClick; 
  23.     static Point   myPt; 
  24.  
  25. /* ********************************************* */
  26.  
  27. static pascal char  MyFilter (theDialog, theEvent, itemHit)
  28.     DialogPtr   theDialog; 
  29.     EventRecord   *theEvent;
  30.     short  *itemHit; 
  31. {
  32.     Rect   tempRect; 
  33.     char   xMyFilter; 
  34.  
  35.     xMyFilter = FALSE;
  36.     if (theEvent->what == mouseDown) 
  37.     {
  38.         myPt = theEvent->where; 
  39.         GlobalToLocal(&myPt); 
  40.          
  41.          
  42.     }
  43.      
  44.     return(xMyFilter);
  45. }
  46.  
  47. /* ======================================================== */
  48.  
  49. /* ======================================================== */
  50.  
  51. /* This is an update routine for non-controls in the dialog */ 
  52. /* This is executed after the dialog is uncovered by an alert */ 
  53. static void  Refresh_Dialog(GetSelection) 
  54.     DialogPtr    GetSelection;
  55.     Rect    tempRect;
  56.     short    DType;
  57.     Handle    DItem;
  58.     ControlHandle    CItem;
  59.  
  60.     /* Draw a rectangle, Rectangle1 */
  61.     SetRect(&tempRect, 1,1,308,260);
  62.     FrameRect(&tempRect);
  63.     
  64.  
  65. /* ======================================================== */
  66.  
  67.  
  68. void   D_About_Dialog_Box()
  69. {
  70.     DialogPtr    GetSelection;
  71.     Rect    tempRect;
  72.     short    DType;
  73.     short    Index;
  74.     Handle    DItem;
  75.     ControlHandle    CItem, CTempItem;
  76.     Str255    sTemp;
  77.     short    itemHit;
  78.     short    temp;
  79.     Handle   Icon_Handle;
  80.     Point  NewMouse; 
  81.     char   InIcon; 
  82.     TEHandle   ThisEditText; 
  83.     DialogPeek   TheDialogPtr;
  84.      
  85.     GetSelection = GetNewDialog(2, NIL, (WindowPtr)-1);
  86.      
  87.     tempRect.top = GetSelection->portRect.top;
  88.     tempRect.left = GetSelection->portRect.left;
  89.     tempRect.bottom = GetSelection->portRect.bottom;
  90.     tempRect.right = GetSelection->portRect.right;
  91.     tempRect.top = ((screenBits.bounds.bottom - screenBits.bounds.top) - (tempRect.bottom - tempRect.top)) / 2;
  92.     tempRect.left = ((screenBits.bounds.right - screenBits.bounds.left) - (tempRect.right - tempRect.left)) / 2;
  93.     MoveWindow(GetSelection, tempRect.left, tempRect.top, TRUE);
  94.      
  95.     ShowWindow(GetSelection);
  96.     SelectWindow(GetSelection);
  97.     SetPort(GetSelection);
  98.      
  99.      
  100.     /* Setup initial conditions */
  101.     Refresh_Dialog(GetSelection); 
  102.      
  103.     ExitDialog = FALSE; 
  104.      
  105.     do
  106.     {
  107.         ModalDialog(NIL, &itemHit); 
  108.         GetDItem(GetSelection, itemHit, &DType, &DItem, &tempRect);
  109.         CItem = (ControlHandle)DItem; 
  110.          
  111.         /* Handle it real time */
  112.         if (itemHit == I_Picture2 )
  113.         {
  114.             /* ?? Code to handle this picture goes here */
  115.         }
  116.         
  117.         /*  ?? ******** */
  118.         ExitDialog = TRUE; 
  119.         /*  ?? ******** */
  120.          
  121.     } 
  122.     while (ExitDialog == FALSE);
  123.      
  124.     /* Get results after dialog */
  125.     
  126.     DisposDialog(GetSelection); 
  127.     
  128. }
  129.  
  130.  
  131.